const defaultState = {
    showAlert: false,
    alertType: "info",
    alertContent: "嘻嘻,臭宝"
};

 let reducer =(state = defaultState, action) => {

    let newState = JSON.parse(JSON.stringify(state));

    switch (action.type) {
        case "showAlert":
            newState.showAlert = action.value.showAlert;
            newState.alertType = action.value.alertType;
            newState.alertContent = action.value.alertContent
            break;
        case "hideAlert":
            newState.showAlert=false
            break;
        default:
            break;
    }
    return newState;
};
export default reducer